﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Basmus.BindingFramework;

namespace Sample
{
	public partial class WebForm : System.Web.UI.Page
	{
		[NamedTuple("company", ElementType = typeof(Company))]
		public Company Company { get; set; }

		[NamedTuple("products", ElementType = typeof(Product))]
		public IEnumerable<Product> Products { get; set; }

		[NamedTuple("supplies", ElementType = typeof(Supply))]
		public IEnumerable<Supply> Supplies { get; set; }

		protected void Page_Init(object sender, EventArgs e)
		{
			var dataContext = new DbDataContext();
			var binder = new PageDataContextBinder(Page, dataContext);
			binder.ApplyNameValueCollectionRules(Request.QueryString);
		}
	}
}
